package com.example.demo.bean;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 自定义分页
 * @param <T>
 */
@Data
public final class PageRes<T> implements Serializable {

    private List<T> list;

    private Long total;

    public PageRes(){

    }

    public PageRes(List<T> list,Long total){
        this.list = list;
        this.total = total;
    }

    public PageRes(Long total){
        this.list = new ArrayList<>();
        this.total = total;
    }

    public static <T> PageRes<T> empty(){
        return new PageRes<>(0L);
    }

    public static <T> PageRes<T> empty(Long total){
        return new PageRes<>(total);
    }
}
